///////////////////////////////////////////////////////////////////////////////
///
/// Cylan Client Core
/// Copyright (C) Shenzhen Cylan Tech. Co., Ltd. 2012
///
/// @file       ICABControl.h
/// @brief      ICAB控制API
///
///////////////////////////////////////////////////////////////////////////////
#ifndef ICAB_CONTROL_H
#define ICAB_CONTROL_H

#include "Core/Core.h"

/**
 * @def ICAB_MOUSE_RELEASE
 * @brief 鼠标按键释放
 */
#define ICAB_MOUSE_RELEASE      0x0000

/**
 * @def ICAB_MOUSE_PRESS
 * @brief 鼠标按键按下
 */
#define ICAB_MOUSE_PRESS        0x8000

/**
 * @def ICAB_MOUSE_LBUTTON
 * @brief 鼠标左按键
 */
#define ICAB_MOUSE_LBUTTON      0x1000

/**
 * @def ICAB_MOUSE_RBUTTON
 * @brief 鼠标右按键
 */
#define ICAB_MOUSE_RBUTTON      0x2000

/**
 * @def ICAB_MOUSE_MBUTTON
 * @brief 鼠标中按键
 */
#define ICAB_MOUSE_MBUTTON      0x4000

/**
 * @def ICAB_MOUSE_WHEEL_UP
 * @brief 鼠标滚轮向上
 */
#define ICAB_MOUSE_WHEEL_UP     (0x0200 | 0x80)

/**
 * @def ICAB_MOUSE_WHEEL_DOWN
 * @brief 鼠标滚轮向下
 */
#define ICAB_MOUSE_WHEEL_DOWN   (ICAB_MOUSE_WHEEL_UP | 0x0100 | 0x80)

/**
 * @def WheelRotationMask
 * @brief 滚动粒度Mask
 */
#define WheelRotationMask       0x01FF

/**
 * @def ICAB_MOUSE_MOVE
 * @brief 鼠标指针移动
 */
#define ICAB_MOUSE_MOVE         0x0800


#define ICAB_KBD_EXTENDED       0x0100

/**
 * @def ICAB_KBD_PRESS
 * @brief 按键按下
 */
#define ICAB_KBD_PRESS          0x4000

/**
 * @def ICAB_KBD_RELEASE
 * @brief 按键释放
 */
#define ICAB_KBD_RELEASE        0x8000


#ifndef _WIN32
/**
 * @def 参见 WinUser.h
 * @brief windows 水平滚动条消息
 */
#define WM_HSCROLL              0x0114
#define SB_LINELEFT             0x0
#define SB_LINERIGHT            0x1

#endif
/**
 * @fn CC_STATUS ICABSendMouse(CHANDLE ICAB, unsigned short Flag, int x, int y)
 * @brief 发送鼠标消息
 * @param ICAB ICAB句柄
 * @param Flags 鼠标消息标志
 * @param x X坐标
 * @param y Y坐标
 * @retval ERR_SUCCESS 发送成功
 * @retval ERR_NETWORK_BLOCK 发送阻塞
 * @warning 返回ERR_NETWORK_BLOCK时, 该操作并未发出.
 */
CC_STATUS ICABSendMouse(CHANDLE ICAB, unsigned short Flags, int X, int Y);


/**
 * @fn CC_STATUS ICABSendKeyboard(CHANDLE ICAB, unsigned short Flags, unsigned short Code)
 * @brief 发送键盘消息
 * @param ICAB ICAB句柄
 * @param Flag 键盘消息标志
 * @param Code 键盘扫描码
 * @retval ERR_SUCCESS 发送成功
 * @retval ERR_NETWORK_BLOCK 发送阻塞
 * @warning 返回ERR_NETWORK_BLOCK时, 该操作并未发出.
 */
CC_STATUS ICABSendKeyboard(CHANDLE ICAB, unsigned short Flags, unsigned short Code);

/**
 * @fn CC_STATUS ICABSendUnicode(CHANDLE ICAB, unsigned short Code)
 * @brief 发送Unicode字符输入
 * @param ICAB ICAB句柄
 * @param Code 字符的Unicode编码
 * @retval ERR_SUCCESS 发送成功
 * @retval ERR_NETWORK_BLOCK 发送阻塞
 * @warning 返回ERR_NETWORK_BLOCK时, 该操作并未发出.
 */
CC_STATUS ICABSendUnicode(CHANDLE ICAB, unsigned short Code);


/**
 * @fn void ICABSendSuppressOutput(CHANDLE ICAB)
 * @brief 通知服务器停止发送画面更新, 一般用于隐藏ICAB画面时防止刷屏
 */
CC_STATUS ICABSendSuppressOutput(CHANDLE ICAB);


/**
 * @fn void ICABSendResumeOutput(CHANDLE ICAB)
 * @brief 通知服务器继续发送画面更新, 一般用于从ICAB隐藏画面恢复
 */
CC_STATUS ICABSendResumeOutput(CHANDLE ICAB);


/**
 * @fn void ICABSendRefreshRequest(CHANDLE ICAB)
 * @brief 请求服务器发送一个屏幕重绘
 */
CC_STATUS ICABSendRefreshRequest(CHANDLE ICAB);

/**
 * @fn CC_STATUS ICABHscroll(CHANDLE ICAB, int PosX, int PosY, int HorizontalDistance)
 * @brief 发送左右滑动信息
 * @param PosX, PosY当前手指滑动的x/y坐标
 * @param ICAB ICAB句柄 
 * @param HorizontalDistance 滑动距离, < 0 向左， > 0 向右 
 * @retval ERR_SUCCESS 发送成功
 */
//CC_STATUS ICABHScroll(CHANDLE ICAB, int PosX, int PosY, int HorizontalDistance);

#endif /* ICAB_CONTROL_H */
